#include "aliasType.h"
#include "IVisitor.h"

aliasType::aliasType(const NameTokPtr& name, const NameTokPtr& asname, int nodeId):
    SimpleNode(nodeId),
    _name(name),
    _asname(asname)
{
}
    
aliasType::~aliasType()
{
    
}
    
Ast::AstTypes aliasType::type() const
{
    return Ast::aliasType;
}
    

NameTokPtr aliasType::name()
{
    return _name;
}

void aliasType::setName(const NameTokPtr& name)
{
    _name = name;
}

NameTokPtr aliasType::asname()
{
    return _asname;
}

void aliasType::setAsname(const NameTokPtr& asname)
{
    _asname = asname;
}

    
QString aliasType::toString() const
{
    return QString("aliasType[name=%1, asname=%2]").
                arg(_name ? _name->toString():"").
                arg(_asname ? _asname->toString():"");
}
    
void aliasType::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    traverse(visitor);
}
    
void aliasType::traverse(IVisitor* visitor)
{
    if (_name != NULL)
        _name->accept(visitor, _name);
    if (_asname != NULL)
        _asname->accept(visitor, _asname);
}